package com.ds.infrastructure.audit.admin.vo;

import lombok.Data;

/**
 * @author ethan
 */
@Data
public class DefaultResponseVO {

    private static final String SUCCESS_MESSAGE = "Ok";

    public static final DefaultResponseVO SUCCESS = new DefaultResponseVO(1, SUCCESS_MESSAGE);

    private int status;

    private String message;

    private Long total;

    private Object data;

    private DefaultResponseVO(int status, String message) {
        this.status = status;
        this.message = message;
    }

    private DefaultResponseVO(int status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    private DefaultResponseVO(int status, String message, Long total, Object data) {
        this.status = status;
        this.message = message;
        this.total = total;
        this.data = data;
    }

    public static DefaultResponseVO fail(String message) {
        return new DefaultResponseVO(0, message);
    }

    public static DefaultResponseVO success(Object data) {
        return new DefaultResponseVO(1, SUCCESS_MESSAGE, data);
    }

    public static DefaultResponseVO success(Long total, Object data) {
        return new DefaultResponseVO(1, SUCCESS_MESSAGE, total, data);
    }

}
